﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Events
{
    class Program
    {
        public static void OnWndPaint(object sender, EventArgs e)
        {
            Window w = sender as Window;
            Console.WriteLine("left: {0} top: {1} right: {2} bottom: {3}",w.Left,w.Top,w.Right,w.Bottom);
        }

        public static void OnInit(object sender, EventArgs e)
        {
            Window w = sender as Window;
            Console.WriteLine("Initialize done");
        }


        static void Main(string[] args)
        {
            Window wnd = new Window(100,100);

            wnd.OnInit += OnInit;
            wnd.OnPaint += OnWndPaint;

            wnd.Create();

            Console.WriteLine("Press any key to move window");
            Console.ReadLine();
            wnd.Move(30, 30);

            //анонімні 
            wnd.OnPaint += delegate(object obj, EventArgs e)
            {
                Console.WriteLine("Magic here");
            };

            wnd.Move(300, 300);

        }
    }
}
